#include "Util/MessageWindow.hpp"
#include <string>
#include <Windows.h>
namespace Util{
class WinMessageWindow : public MessageWindow
{
public:
	WinMessageWindow():
	 m_message()
	,m_caption()
	,m_type(TYPE_OK)
	,m_icon(ICON_INFORMATION){}
	virtual void setMessage(const char* message)
	{
		m_message = message;
	}
	virtual void setCaption(const char* caption)
	{
		m_caption = caption;
	}
	virtual void setType(Type type)
	{
		m_type = type;
	}
	virtual void setIcon(Icon icon)
	{
		m_icon = icon;
	}
	virtual Result show()const
	{
		const int result = MessageBoxA(GetActiveWindow(),m_message.c_str(),m_caption.c_str(),m_type | m_icon);
		if(0 <= result && result <= 8)
		{
			return static_cast<Result>( result );
		}
		return RESULT_FAIL;
	}
private:
	std::string m_message;
	std::string m_caption;
	Type m_type;
	Icon m_icon;
};

MessageWindow::ptr MessageWindow::create()
{
	return MessageWindow::ptr(new WinMessageWindow());
}
}//Util